package lance.honeydew.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import lance.honeydew.action.ManageAction;

import org.apache.log4j.Logger;

public class DateUtil {

	private static final Logger logger = Logger.getLogger(DateUtil.class);
	
	public static Date dbStrToDate(String str) {
		
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date date = null;
		
		try {
			date = sdf.parse(str);
		} catch (Exception e) {
			logger.debug(e);
		}
		
		return date;
	}
	
	public static String dbDateToStr(Date date) {
		
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		String str = "";
		
		try {
			str = sdf.format(date);
		} catch (Exception e) {
			logger.debug(e);
		}
		
		return str;
	}
}
